Skip to content

fix(auth): Speed up the PageIterator by evaluating items once per page #572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2021

Conversation

davidwtbuxton
Copy link
Contributor

@davidwtbuxton davidwtbuxton commented Sep 8, 2021

The firebase_admin.auth.list_users().iterate_all() method uses a sub-class
of PageIterator, which happens to access the .items computed property more
than once for every page of results. This has been changed so we take care
not to access the self.items property more than once per page.

This is a lot faster.

Fixes #571

Copy link
Contributor

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @davidwtbuxton for looking into this. Fix looks pretty good. Just had one suggestion. WDYT?

@hiranya911 hiranya911 self-assigned this Sep 8, 2021
@hiranya911 hiranya911 changed the title Speed up the PageIterator by evaluating items once per page fix(auth): Speed up the PageIterator by evaluating items once per page Sep 8, 2021
The `firebase_admin.auth.list_users().iterate_all()` method uses a sub-class
of PageIterator, which happens to access the .items computed property more
than once for every page of results. This has been changed so we take care
not to access the `self.items` property more than once per page.

This is a lot faster.
Copy link
Contributor

@hiranya911 hiranya911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@hiranya911 hiranya911 merged commit 52eb94a into firebase:master Sep 8, 2021
@davidwtbuxton davidwtbuxton deleted the page-iterator-speedups branch June 10, 2022 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Very slow performance with firebase_admin.auth.list_users().iterate_all()
2 participants